<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>04_设置css样式</title>
    <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    <style>
        .eleColor{
            color: red;
        }
        .elebgc{
            background-color: aqua;
        }
        .eleBorder{
            border: 2px solid;
        }
        .eleFontSize{
            font-size: 30px;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    <script type="text/babel">
        let app = document.getElementById("app");
        /* 1、如果通过class设置样式，在JSX语法里的class属性名需要修改成className */
        ReactDOM.render((
            <div>
                <h2 className="eleColor">这是h2标签</h2>
                <p className="elebgc eleBorder">这是段落标签</p>
                <div className="eleFontSize">这是div标签</div>
            </div>
        ),app)
        /* 2、如果要给JSX语法结构里的标签设置行间CSS样式，依然适用style属性,但是style的值不再支持字符串，而是一个对象，而对象必须写到react的编译环境里 */
        let liborder = {border:"1px solid blue"}
        let li1 = {backgroundColor:"aqua"};
        let li2 = {backgroundColor:"red"};
        let li3 = {backgroundColor:"green"};
        ReactDOM.render((
            <ul style={{border:"1px solid red"}}>
                <li style={{...li1,...liborder}}>列表项1</li>    
                <li style={li2}>列表项2</li>   
                <li style={li3}>列表项3</li>   
            </ul>
        ),app)
    </script>
    
</body>
</html>